Jump to content

Skorm

Forum Moderator
  • Posts

    1282
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Skorm

  1. It took me a bit to understand dynamic shops when I was first learning too. This is the npc I used to understand dynamic shops but I added a bunch of comments hopefully it helps. ( Disclaimer: This npc is old and doesn't have all the necessary weight checks and mumbo-jumbo I'm providing it as an example because it's simple. ) - shop custom_seller2 -1,501:20 // Create our dummy shop. prontera.gat,95,99,5 script WoE Shop 100,{ // This code runs when the user clicks our npc. mes "I will sell you items for " + getitemname(.CoinID) + "."; // Let the user know about our shop. callshop "custom_seller2",1; // Summon our dummy shop filled with custom items. npcshopattach "custom_seller2"; // Attach the shop to this npc. end; // This code runs when a user purchases an item from our shop. OnBuyItem: .@len = getarraysize(.customs); // Get the number of customs we've added. .@b_len = getarraysize(@bought_nameid); // Get the number of purchased items. for( set @i, 0; @i < .@len; set @i, @i+1 ) { // Loop through all our custom items. for( set @d,0; @d < .@b_len; set @d, @d+1 ) { // Loop through all the purchased items. if( @bought_nameid[@d] == .customs[@i] ) { // Check if the purchased item equals our custom item. if( countitem(.CoinID) >= .Price[@i] * @bought_quantity[@d] ) { // Check if the user has the correct funds. delitem .CoinID,.Price[@i]*@bought_quantity[@d]; getitem @bought_nameid[@d],@bought_quantity[@d]; } } } } deletearray @bought_quantity, getarraysize(@bought_quantity); // Remove the array. deletearray @bought_nameid, getarraysize(@bought_nameid); // Remove the array. close; // This code runs first. When the server is started. OnInit: setarray .customs[0],12103,607,678; // An array of our custom items. set .CoinID,7227; // Currency used for the transaction. setarray .Price[0],20,40,300; // The amount of coins needed for our items. (For example: Item 12103 = 20 coins) npcshopitem "custom_seller2",0,0; // Remove all items from our dummy shop. for( set .@i, 0; .customs[.@i]; set .@i, .@i+1 ) // Loop through our custom items. npcshopadditem "custom_seller2",.customs[.@i],.Price[.@i]; // Add our custom items to the cleared dummy shop. end; }
  2. I agree with @Cydh only use OnNPCKillEvent: when you absolutely have to. Since it's going to trigger every time a mob gets killed in your server ever...
  3. query_sql("INSERT INTO `event_rewards` ( `account_id`, `event_name`, `id`, `amount`, `value` ) VALUES ( "+.@account_id[.i]+", '"+.@eventname$+"', "+.@prize[.j]+", "+.@pamount[.k]+", 0) ");
  4. You only need escape_sql when dealing with string variables. .@id is a integer variable so nobody can put an escape character like "; or something to cause harm to your database. if the variable was .@id$ and a user put text for that .@id$ variable like '; DROP TABLE `accounts`; MySQL would read select `field` from `table` where `field` = ''; DROP TABLE `accounts`;
  5. '"+@NewName$+"' It's not double quotes like you have. It's quotes ( " ) then single quotes ( ' ). The single quotes are for SQL to be like OK this is a string. Normal Quotes are there to break the string server side. So what it's doing "String '(Start SQL String) (Break NPC Compiler String)"+(.@npc_string_variable$)+"(Enter NPC String) (End SQL String)' (End NPC String)"
  6. Find line 1179 in pet.c should look something like this. } else { // Item Targeted, attempt loot if (!check_distance_bl(&pd->bl, target, 1)) { // Out of range if(!unit_walktobl(&pd->bl, target, 1, 1)) // Unreachable target. pet_unlocktarget(pd); return 0; } else { struct flooritem_data *fitem = (struct flooritem_data *)target; Comment out this part. if(pd->loot->count < pd->loot->max) { memcpy(&pd->loot->item[pd->loot->count++],&fitem->item,sizeof(pd->loot->item[0])); pd->loot->weight += itemdb_weight(fitem->item.nameid)*fitem->item.amount; map_clearflooritem(target); } add below. if (!pc_additem(sd, &fitem->item, fitem->item.amount, LOG_TYPE_PICKDROP_PLAYER)) { map_clearflooritem(target); }
  7. atoi stands for ASCII to Integer. String -> Number getitemname uses an integer value you don't need to use atoi.
  8. I just tested the exact script you posted it works fine on my server np.
  9. I really don't think you have to worry about your database collapsing but if you're really concerned. Store all the kills in a character defined variable and then push them to the database when they logout. OnPCLogoutEvent: if( @kills || @deaths ) query_sql("UPDATE `pvp_table` SET kills += "+@kills+", deaths += "+@deaths+" WHERE charid == "+getcharid(0)+";"); This is just to give you an idea you'll still have to check to see that a table has been created for that user before you can update it. There are plenty of other ways you could do something like this, but honestly you probably don't even have to worry about it unless you have an inane amount of players.
  10. If the users can instantiate SQL queries on a whim they could flood your SQL server with many requests. If controlled SQL makes it very easy todo things that would normally be time consuming in scripts with variables. For example: SELECT * FROM item_db_re ORDER BY price_buy DESC LIMIT 5; With one line I can easily find what are the most expensive items to purchase in the game. You could easily apply something like this to a pvp ranker. If you plan on keeping all your data for the players in variables they get hard to manage and remove, and the sql table for perm variables gets pinged by the server quite often so it's best to keep that as small as you can. This is where I would recommend using an SQL database. Without getting into it any further what I'm trying to say is. If used correctly SQL can be a powerful tool that should be taken advantage of, and for bigger scripts with lots of numbers and information there's no reason not to use SQL.
  11. Post the code you're testing in full.
  12. They forgot to use escape_sql() command when allowing the user to type things in when querying the sql server... So someone could end the statement early by adding ; then type their own stuff. Like ; DROP TABLE `accounts`; Or something much worse hahaha
  13. It should be in the unequip database section. When the RENTAL ITEM RUNS-OUT it activates the unequip-script this is something I tested and it was working at that time. If something changed with the source between when I tested it there isn't anything I can do about that. I recommend testing it further and submitting a bug report.
  14. When you mark things @solved and erase the initial question. If other people have a similar problem they can't find an answer, and it makes this entire topic useless. You can mark the topic solved by selecting a best answer... We're not here to host more useless threads.
  15. quiz_00,17,124,4 script Katonai 821,{ mes .npc$; mes "Hello there!"; mes "I can enchant your items,"; mes "for a small fee of "+.pric+"z."; emotion e_no1,0; next; if(select("Yes:No")&2) { mes .npc$; mes "Alright, thanks anyways!"; close; } if(Zeny<.pric) { mes .npc$; mes "I'm sorry you don't have enough Zeny, please come back later."; close; } mes .npc$; mes "Which item would you like to enchant?"; next; for( .@a = 0; .@a < .e_len; .@a++ ) { if(getequipid(.equiploc[.@a])>-1) { set .@menu$, .@menu$+.eqp$[.@a]+"- [^0000FF"+getitemname(getequipid(.equiploc[.@a]))+"^000000]:"; } else { set .@menu$, .@menu$+"^adb4be"+.eqp$[.@a]+"- [Empty]^000000:"; } } select(.@menu$); set .@eq_loc, .equiploc[@menu-1]; set .@eq_itm, getequipid(.@eq_loc); if(.@eq_itm<0) { mes .npc$; mes "Hmm, I don't think you have anything equipped there."; close; } set .@menu$, ""; set(.@eq,(getiteminfo(.@eq_itm,2)==4?4:.@eq_loc)); for(set(.@b,0);.@b<getarraysize(getd(".itm"+.@eq));set(.@b,.@b+1)) { set(.@items,getd(".itm"+.@eq+"["+.@b+"]")); if(getiteminfo(.@items,2)>-1) if(set(.@c,countitem(.@items))) { set .@menu$, .@menu$+getitemname(.@items)+" x"+.@c+":"; set .@b,.@b+1; set .@item[.@b], .@items; } } if(.@menu$=="") { mes .npc$; mes "Hmm, you don't seem to have any enchantment orbs for that equipment."; close; } mes .npc$; mes "Please, select an enchantment from the menu."; next; select(.@menu$); set .@itm, .@item[@menu]; set .@menu$, ""; set .@a, 0; while((set(.@a,.@a+1)-1)<4) { setd(".@crd"+.@a, getequipcardid(.@eq_loc,.@a-1)); if(getequipcardid(.@eq_loc,.@a-1)) set .@menu$, .@menu$+.@a+.crd_c$[.@a-1]+" Slot- [^a92435"+getitemname(getequipcardid(.@eq_loc,.@a-1))+"^000000]:"; else set .@menu$, .@menu$+.@a+.crd_c$[.@a-1]+" Slot- [^30ad25Empty^000000]:"; } mes .npc$; mes "Select a slot."; next; set(.@slot,select(.@menu$)-1); set .@eqrf, getequiprefinerycnt(.@eq_loc); if(getequipcardid(.@eq_loc,.@slot)) { mes .npc$; mes "Would you like me to remove this card?"; next; if(select("Yes:No")&2) { mes .npc$; mes "Alright, thanks anyways!"; close; } getitem getequipcardid(.@eq_loc,.@slot),1; delitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@crd1, .@crd2, .@crd3, .@crd4; setd(".@crd"+(@menu+1), 0); getitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@crd1, .@crd2, .@crd3, .@crd4; } if(rand(101)>.perc[.@slot]) { mes .npc$; mes "I'm sorry but I've failed you!"; misceffect 155; emotion e_sob,0; set Zeny,Zeny-.pric; close; } set Zeny,Zeny-.pric; delitem .@itm,1; delitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@crd1, .@crd2, .@crd3, .@crd4; setd(".@crd"+(@menu+1), .@itm); getitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@crd1, .@crd2, .@crd3, .@crd4; misceffect .efet; emotion e_no1,0; mes .npc$; mes "All done!"; equip .@eq_itm; close; //NPC Constants OnInit: //=-=-=-=-=-=-=Configuration=-=-=-=-=-=-= set .npc$ , "[^0000FFEnchant Expert^000000]"; // NPC Name set .pric , 1000000; // Price set .efet , 154; // Effect Number setarray .perc , 100,80,50,10; // Percent slot setarray .crd_c$, "st", "nd", "rd", "th"; // Count setarray .itm32 , 4760; // Sheilds setarray .itm16 , 4761; // Armor setarray .itm4 , 4762; // Garment setarray .itm64 , 4763, 4764; // Footgear setarray .itm128 , 4765; // Accessory1 setarray .itm10 , 4766; // Accessory2 setarray .itm2 , 4765; // Weapon setarray .itm1 , 4766; // Low Headgear setarray .itm512 , 4767; // Mid Headgear setarray .itm256 , 4767; // Upper Headgear setarray .eqp$ , "Upper Headgear", "Mid Headgear", "Low Headgear", "Armor", "Left Hand", "Right Hand", "Garment", "Shoes", "Accessory1", "Accessory2"; setarray .equiploc, EQI_HEAD_TOP, EQI_HEAD_MID, EQI_HEAD_LOW, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R; set .e_len , getarraysize(.eqp$); //=-=-=-=-=-=-=-=-Skorm-=-=-=-=-=-=-=-=-= } Working version.
  16. @Z3R0 I know I've already said this but welcome back... (You might want to consider fixing your signature xD) It's always great to see some of the older people coming back.
  17. @Olrox It's good to see you posting again. Fantastic work again.
  18. I feel like @Cydh did a @storagegetitem or something... I know there is a command to delete items from storage and count them. https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L4697-L4698 https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L4764-L4765 I also did a mod to add items to guild storage but it's old so I'm not sure if it still works but you could use that as a base.
  19. Don't worry about it someone else might have the same question later on. @Kaze has a good answer so I'll mark that.
  20. Just like to mention @goddameit did this back in 2011 with bad apple. Bad Apple Props to him for that.
  21. View File RWC Battleground 2012 This file is in no way Official. This is my interpretation of the Ragnarok World Championships Battleground system. Since this file has been up for years and I haven't seen a penny from it. I will not be offering support for the file if it is purchased here. Please contact me directly. Please run the SQL Commands at the beginning of the script file before installing said script. This script DOESN'T work without SQL support. What is this NPC? This is basically like a GVG script but it warps players who are in a party/guild into a map where they all ready up. After that, there is a waiting period where they can buff. Then they battle for however many rounds and get prizes at the end. What can it do? Ranking. Unrestricted Party Queuing. ( You can queue up and go do other things while you wait. ) Disable Usable Items. Disable Equip-able Items. Restrict Party to Specific Jobs. ( Restrict Duplicate Jobs as well ) Modify what maps it works on. Require Items. Cooldown. Disable Commands. Item/Point Rewards. IP Abuse Prevention. ( Mac Address in applicable servers. ) Auto party. Healer and repairer NPCs. Join or leave anywhere with @rwcjoin & @rwcleave. Completely customizable interface. Here are some of the other files you might need: Map Files ItemInfo Accessory Enchanter Item Database If you purchase this script from rAthena.org I will offer full support for the features listed above. Additional feature requests are ok but added at my own discretion. Email: [email protected] Submitter Skorm Submitted 04/28/2017 Category PvP, GvG, WoE, Battleground Video https://youtu.be/kSJYZVCYBzI Content Author Skorm  
  22. Version 6.3.2

    239 downloads

    This file is in no way Official. This is my interpretation of the Ragnarok World Championships Battleground system. Since this file has been up for years and I haven't seen a penny from it. I will not be offering support for the file if it is purchased here. Please contact me directly. Please run the SQL Commands at the beginning of the script file before installing said script. This script DOESN'T work without SQL support. What is this NPC? This is basically like a GVG script but it warps players who are in a party/guild into a map where they all ready up. After that, there is a waiting period where they can buff. Then they battle for however many rounds and get prizes at the end. What can it do? Ranking. Unrestricted Party Queuing. ( You can queue up and go do other things while you wait. ) Disable Usable Items. Disable Equip-able Items. Restrict Party to Specific Jobs. ( Restrict Duplicate Jobs as well ) Modify what maps it works on. Require Items. Cooldown. Disable Commands. Item/Point Rewards. IP Abuse Prevention. ( Mac Address in applicable servers. ) Auto party. Healer and repairer NPCs. Join or leave anywhere with @rwcjoin & @rwcleave. Completely customizable interface. Here are some of the other files you might need: Map Files ItemInfo Accessory Enchanter Item Database If you purchase this script from rAthena.org I will offer full support for the features listed above. Additional feature requests are ok but added at my own discretion. Email: [email protected]
    5.00 USD
  23. There were a few problems when trying to use it with Euphy's WOE controller also I hadn't thought about the fact that 0 actually means something in this script. So getarraysize didn't work correctly when sunday was the last day in your list. To fix that I had to change the days from 1 ~ 7 instead of 0 ~ 6... That on its own was pretty easy but Euphy's script still uses 0 ~ 6 so I had to do a bunch of arbitrary junk to still keep it a standalone npc yet compatible with Euphy's script. Firstly don't remove credits. ( Seriously I can't stress that enough. ) Uhh... So I didn't have a lot of time tonight. I will make an integrated version with Euphy's WOE controller but there are a few things with his script that I wanted to change/add. Alternatively you could just put this npc on the same location as his npc but make it invisible with sprite number 139. Anyways here is a working standalone version that is compatible with Euphy's WOE Controller. ( Sorry @neXus it's the version with Days, Minutes, Seconds. I'll make it easier to change that or something. ) //Skormie's WOE Waitingroom Timer v1.03 //Should natively work with Euphy's WOE Controller. prontera,151,193,5 script Woe Time 100,{ end; OnInit: function s; function woe_update; // CONFIG // ...If you're not using Euphy's Woe Controller. setarray .@start_day, 5, 1; //Day of the week WOE Starts on. (1 for Sunday, 7 is Saturday) setarray .@start_hour, 20, 0; //rAthena works on a 24 hour clock. .auto_update = 60; //Auto update timer in seconds. .woe_len = getarraysize( .@start_day ); for( .@i = 0; .@i < .woe_len; .@i++ ) { .woe_day[ .@i * 4 ] = .@start_day[ .@i ] -1; .woe_day[ (.@i * 4) + 1 ] = .@start_hour[ .@i ]; } .woe_len = ( ( .woe_len ) * 4 ); woe_update(); while ( 1 ) { if( !( gettimetick(2) % .auto_update ) ) woe_update(); .@woe_tick = .woe_time[.current] - gettimetick(2); .@day = .@woe_tick / 86400; .@hour = .@woe_tick % 86400 / 3600; .@min = .@woe_tick % 3600 / 60; .@sec = .@woe_tick % 60; .@mes$ = ( .@day ? .@day +" day"+ s( .@day ) : "" ) + ( .@hour ? .@hour +" hour"+ s( .@hour ) : "" ) + ( .@min ? .@min +" minute"+ s( .@min ) : "" ) + ( .@sec ? .@sec +" second"+ s( .@sec, 1 ) : "" ); delwaitingroom strnpcinfo(0); waitingroom ( .woe_len ? ( agitcheck() ? "WOE is Active!" : .@mes$ ) : "WOE is Disabled!" ), 0; sleep 1000; } end; OnAgitEnd: woe_update(); end; function s { return ( getarg(0) > 1 ? "s" : "" ) + ( getarg(1,0) ? "" : " " ); } function woe_update { if( getnpcid( 0, "WOE_CONTROL" ) ) { .@Euphy_Len = getarraysize( $WOE_CONTROL ); copyarray .woe_day, $WOE_CONTROL, .@Euphy_Len; .woe_len = .@Euphy_Len; } for( .@a = 0; .@a < .woe_len; .@a += 4 ) { .@woe_day[.@a] = ( .woe_day[.@a] - gettime(4) + 7 ) % 7 * 86400; .@woe_hour[.@a] = ( .woe_day[.@a+1] * 3600 ) - gettimetick(1); .woe_time[.@a] = gettimetick(2) + .@woe_day[.@a] + .@woe_hour[.@a]; if(gettimetick(2) > .woe_time[.@a]) .woe_time[.@a] = .woe_time[.@a] + 7 * 86400; if( .woe_time[.@a] <= .woe_time[.current] ) .current = .@a; } } }
  24. Thanks for your continued support @zackdreaver.
×
×
  • Create New...