def QuestCompleted(id): if Quest.GetQuestState(id) != 2: return False else: return True
def QuestInProgress(quest, npc): if Quest.CheckCompleteDemand(quest, npc) != 0: return True else: return False
# 8/18/2018 # Set it True or False if you like to have equip boxes open automatically OpenBox = True # Set True or False for ToT quest of the level to be done Lv20 = True Lv30 = True Lv40 = True Lv50 = True Lv60 = True ############################################# if GameState.IsInGame(): print("Running") if Lv20 and Quest.GetQuestState(61586) != 2 and Character.GetLevel() >= 20: Terminal.SetCheckBox("bot/puffram", False) Npc.ClearSelection() Npc.RegisterSelection("Cash Shop") Npc.RegisterSelection("Beauty Salon") Npc.RegisterSelection("Receive") Quest.StartQuest(61586, 9201253) time.sleep(10) elif OpenBox and Quest.GetQuestState(61586) == 2: if Inventory.FindItemByID(2430445).valid: Inventory.UseItem(2430445) if Lv30 and Quest.GetQuestState(61587) != 2 and Character.GetLevel() >= 30: Terminal.SetCheckBox("bot/puffram", True) time.sleep(10) elif OpenBox and Quest.GetQuestState(61587) == 2:
def initiate_combat(self, player_id, monster_id, loc_id, quest_id): preCombatCharacter = Character() preCombatCharAttrs = preCombatCharacter.get_currplayer_attr(player_id) preCombatMonster = Monster.Monster() preCombatMonsterAttrs = preCombatMonster.get_monst_attrs(monster_id) monstHealth = preCombatMonsterAttrs['hitpoints'] charHealth = preCombatCharAttrs['curr_hp'] print("\nYou have entered combat!\n") while (monstHealth > 0 and charHealth > 0): characterInst = Character() monstInst = Monster.Monster() charAttrs = {} monstAttrs = {} loot = {} charAttrs = characterInst.get_currplayer_attr(player_id) monstAttrs = monstInst.get_monst_attrs(monster_id) preDefend = charAttrs['curr_defense'] defend = False print("\nMonst Hit Points: {}\n".format(monstAttrs['hitpoints'])) """CHARACTER OPTIONS""" print("1. Attack\n" "2. Defend\n" "3. Use Item\n") choice = input("Select: ") if choice == "1": #attack hitChance = randint(0, 10) #decide if player attacks or misses if (charAttrs['character_level'] < 5): if (hitChance > 3): hit = True else: hit = False else: if (hitChance > 2): hit = True else: hit = False #do a level comparison to decide a modifier diff = charAttrs['curr_attack'] - monstAttrs['defense'] if (diff > 3): #level check levelDiff = charAttrs['character_level'] - monstAttrs[ 'challenge_level'] if (levelDiff == 0): mult = 1 elif (levelDiff < 0): mult = .75 elif (levelDiff > 0): mult = 1.25 totalDamage = charAttrs['curr_attack'] * mult else: totalDamage = randint(1, 4) #There's a hit if hit == True: print( "\nThat's a hit for {} damage!\n".format(totalDamage)) oldHitP = monstAttrs['hitpoints'] if (oldHitP - totalDamage) < 0: newHitP = 0 else: newHitP = oldHitP - totalDamage print("\nThe monster is down to {} hitpoints!\n".format( newHitP)) if newHitP == 0: print("\nYou've killed the monster!\n") monstHealth = newHitP self.connection.cursor.execute("""UPDATE Monster SET hitpoints={} WHERE monster_id={}""". format(newHitP, monster_id)) self.connection.conn.commit() else: print("\nYou've missed!\n") elif choice == "2": #defend defend = True curr_def = charAttrs['curr_defense'] + 5 self.connection.cursor.execute("""UPDATE Test.Character SET curr_defense='{}' WHERE player_id ='{}'""".format( curr_def, player_id)) self.connection.conn.commit() print("Defense increased to {}".format(curr_def)) elif choice == "3": loot = {} loot = characterInst.get_currplayer_loot(player_id) print("Select Battle Item From Inventory: \n") i = 0 table = [] if (len(loot) == 0): print("No items!\n") else: for item in loot: table.append([ item['loot_name'], item['health_modifier'], item['defense_modifier'], item['attack_modifier'], item['quantity'] ]) print( tabulate(table, headers=[ 'Name', 'Health Modifier', 'Defense Modifier', 'Attack Modifier', 'Quantity' ], showindex='always')) choice = input("Select: ") choiceInt = int(choice) itemChoice = loot[choiceInt] #decrement quantity of item newQuant = itemChoice['quantity'] - 1 if newQuant == 0: #drop item from table self.connection.cursor.execute( """DELETE FROM Character_loot WHERE Character_loot.loot_id IN (SELECT loot_id FROM Loot WHERE loot_name='{}') AND Character_loot.player_id = {}""". format(itemChoice['loot_name'], player_id)) self.connection.conn.commit else: self.connection.cursor.execute(""" UPDATE Character_loot SET quantity={} WHERE Character_loot.loot_id IN (SELECT loot_id FROM Loot WHERE loot_name='{}') AND Character_loot.player_id = {}""".format( newQuant, itemChoice['loot_name'], player_id)) self.connection.conn.commit() print("\nYou chose: {}\n".format(itemChoice['loot_name'])) #defense modifier if (itemChoice['defense_modifier'] > 0): increment = charAttrs['base_defense'] * itemChoice[ 'defense_modifier'] curr_def = charAttrs['curr_defense'] + increment self.connection.cursor.execute( """UPDATE Test.Character SET curr_defense='{}' WHERE player_id ='{}'""".format( curr_def, player_id)) self.connection.conn.commit() print("Defense increased by {}!".format(increment)) print("Defense now at {}".format(curr_def)) #health modifier elif (itemChoice['health_modifier'] > 0): increment = charAttrs['max_hp'] * itemChoice[ 'health_modifier'] if (charAttrs['curr_hp'] + increment) >= charAttrs['max_hp']: curr_health = charAttrs['max_hp'] else: curr_health = charAttrs['curr_hp'] + increment #run query self.connection.cursor.execute( """UPDATE Test.Character SET curr_hp='{}' WHERE player_id ='{}'""".format( curr_health, player_id)) self.connection.conn.commit() print("Health increased by {}!\n".format(increment)) print("Health now at {}\n".format(curr_health)) #attack modifier elif (itemChoice['attack_modifier'] > 0): increment = charAttrs['base_damage'] * itemChoice[ 'attack_modifier'] curr_attack = charAttrs['curr_attack'] + increment #run query self.connection.cursor.execute( """UPDATE Test.Character SET curr_attack='{}' WHERE player_id ='{}'""".format( curr_attack, player_id)) self.connection.conn.commit() print("Attack increased by {}!".format(increment)) print("Attack now at {}\n".format(curr_attack)) #get the attributes again for monster attack, they probably have changed afterAttackChar = Character() charAttrs = afterAttackChar.get_currplayer_attr(player_id) monstAttrs = monstInst.get_monst_attrs(monster_id) if (monstHealth != 0): """MONSTER ATTACK""" hitChance = randint(0, 10) #decide if monster attacks or misses if (monstAttrs['challenge_level'] < 5): if (hitChance > 3): hit = True else: hit = False else: if (hitChance > 2): hit = True else: hit = False #do a level comparison to decide a modifier diff = monstAttrs['damage'] - charAttrs['curr_defense'] if (diff > 3): #level check levelDiff = monstAttrs['challenge_level'] - charAttrs[ 'character_level'] if (levelDiff == 0): mult = 1 elif (levelDiff < 0): mult = .75 elif (levelDiff > 0): mult = 1.25 totalDamage = monstAttrs['damage'] * mult else: totalDamage = randint(1, 4) #There's a hit if hit == True: print("\nMonster has hit you for {} damage!\n".format( totalDamage)) oldHealth = charAttrs['curr_hp'] if (oldHealth - totalDamage) < 0: newHealth = 0 else: newHealth = oldHealth - totalDamage print("\nYou are down to {} HP!\n".format(newHealth)) if newHealth == 0: print("\nYou've been killed!\n") quit() charHealth = newHealth self.connection.cursor.execute("""UPDATE Test.Character SET curr_hp={} WHERE player_id={}""". format( newHealth, player_id)) self.connection.conn.commit() else: print("\nThe monster missed!\n") else: pass #give reward # lootInst = Loot() # reward = {} # reward = lootInst.determine_reward(player_id, "Monster drop") # for key in reward: # self.connection.cursor.execute("""SELECT loot_name FROM Loot WHERE loot_id = {}""" # .format(key)) # loot_name = self.connection.cursor.fetchall()[0][0] # print("\nYou've received a {}. {} of them!".format(loot_name, reward[key])) # lootInst.add_to_inventory(player_id, key, reward[key]) if defend: self.connection.cursor.execute("""UPDATE Test.Character SET curr_defense='{}' WHERE player_id ='{}'""".format( preDefend, player_id)) self.connection.conn.commit() #set player/monster attributes to pre-combat attrs self.connection.cursor.execute( """UPDATE Test.Character SET curr_defense='{}', curr_attack='{}' WHERE player_id ='{}'""".format( preCombatCharAttrs['curr_defense'], preCombatCharAttrs['curr_attack'], player_id)) self.connection.conn.commit() self.connection.cursor.execute( """UPDATE Test.Monster SET defense='{}', damage='{}', hitpoints='{}' WHERE monster_id ='{}'""".format( preCombatMonsterAttrs['defense'], preCombatMonsterAttrs['damage'], preCombatMonsterAttrs['hitpoints'], monster_id)) self.connection.conn.commit() questInst = Quest.Quest() questType = questInst.get_quest_type(quest_id) if questType == 'K': print("You've killed the monster!\n") elif questType == 'R': print("You notice a person in the darkness...\n") print( "\"My God! I never thought I'd get out of here. Thank you, hero!\"\n" ) elif questType == 'F': print("You notice a shiny object on the ground...\n") print("It's a goblet! Must be what that person was looking for\n") questInst.finish_quest(quest_id, player_id) print( "You'll be transported back to the town where you received the quest\n" ) locInst = Location() optionsInst = Options.Options() name = preCombatCharacter.get_char_name(player_id) location = locInst.get_location(name) optionsInst.location_options(player_id, location['city_name'], location['town_description'], location['buildings'])
def RushAndComplete(completemap, questid, npcid): if Field.GetID() != completemap: Terminal.Rush(completemap) while Terminal.IsRushing(): time.sleep(1) else: if Character.GetPos().x < -800 or Character.GetPos().x > 675: Character.Teleport(-800, 153) time.sleep(2) Quest.CompleteQuest(questid, npcid) time.sleep(1) if GameState.IsInGame(): time.sleep(1) while Quest.GetQuestState(34773) != 2: time.sleep(1) Terminal.SetRushByLevel(False) daily1 = Quest.GetQuestState(34780) daily2 = Quest.GetQuestState(34781) daily3 = Quest.GetQuestState(34782) daily4 = Quest.GetQuestState(34783) daily5 = Quest.GetQuestState(34784) daily6 = Quest.GetQuestState(34785) daily7 = Quest.GetQuestState(34786) daily8 = Quest.GetQuestState(34787) daily9 = Quest.GetQuestState(34788) daily10 = Quest.GetQuestState(34789) daily11 = Quest.GetQuestState(34790) daily12 = Quest.GetQuestState(34791) daily13 = Quest.GetQuestState(34792)
import Terminal, Quest, Character, Npc, GameState, time, Field, GameState, Inventory, Packet, sys, os if not any("SunCat" in s for s in sys.path): sys.path.append(os.getcwd() + "\SunCat") try: import SunCat, SCLib, SCHotkey except: print("Couldn't find SunCat module") ####################### ####################### ######### W I P ####### ####################### ####################### quest1 = Quest.GetQuestState(58901) quest2 = Quest.GetQuestState(58902) quest3 = Quest.GetQuestState(58903) quest4 = Quest.GetQuestState(58907) quest5 = Quest.GetQuestState(58908) quest6 = Quest.GetQuestState(58909) quest7 = Quest.GetQuestState(58910) quest8 = Quest.GetQuestState(58911) quest9 = Quest.GetQuestState(58913) quest10 = Quest.GetQuestState(58941) quest11 = Quest.GetQuestState(58942) quest12 = Quest.GetQuestState(58943) quest13 = Quest.GetQuestState(58944) quest14 = Quest.GetQuestState(58945) quest15 = Quest.GetQuestState(58946) quest16 = Quest.GetQuestState(58947)
import Terminal import time import Packet import GameState Terminal.SetRushByLevel(False) print("Starting preq") if GameState.IsInGame(): time.sleep(1) jobid = Character.GetJob() level = Character.GetLevel() if Terminal.IsRushing(): time.sleep(3) fieldid = Field.GetID() quest1 = Quest.GetQuestState(34200) quest2 = Quest.GetQuestState(34201) quest3 = Quest.GetQuestState(34202) quest4 = Quest.GetQuestState(34203) quest5 = Quest.GetQuestState(34204) quest6 = Quest.GetQuestState(34205) quest7 = Quest.GetQuestState(34206) quest8 = Quest.GetQuestState(34207) quest9 = Quest.GetQuestState(34208) quest10 = Quest.GetQuestState(34209) quest11 = Quest.GetQuestState(34210) quest12 = Quest.GetQuestState(34211) quest13 = Quest.GetQuestState(34212) quest14 = Quest.GetQuestState(34213) quest15 = Quest.GetQuestState(34214) quest16 = Quest.GetQuestState(34215)
def j(g): """Appelle l'ouverture du journal des quêtes""" Quest.run_quest_menu(g["quests"], g["quest_details_box"]) return True
if GameState.IsInGame(): time.sleep(1) currentMap = Field.GetID() jobid = Character.GetJob() jobid = Character.GetJob() level = Character.GetLevel() if level >= 200: Terminal.SetRushByLevel(False) # -------------------------------------------------------- # 5TH JOB QUESTS BELOW # -------------------------------------------------------- # 5th job quests # quests erdaCall = Quest.GetQuestState(1460) goddessBlessing = Quest.GetQuestState(1461) mapleStoneQuest = Quest.GetQuestState(1462) grandisStoneQuest = Quest.GetQuestState(1463) tynerumStoneQuest = Quest.GetQuestState(1464) recordOfPower = Quest.GetQuestState(1465) # stones mapleStone = Inventory.FindItemByID(2435734) grandisStone = Inventory.FindItemByID(2435735) tynerumStone = Inventory.FindItemByID(2435736) pathToPast = Quest.GetQuestState(3500) memLane1 = Quest.GetQuestState(3501)
def __addQuest(self, quest, tables, areaTrigger): """only used by constructor""" newQuest = Quest(quest, tables, areaTrigger) self.qList[newQuest.id] = newQuest
# Инициация локаций armor_shop = Location('Лавка продавца брони', player, armor_merchant) street = Location('Улица', player, weapon_merchant, bandit, {armor_shop}, {'money': 1}) armor_shop.where_to_go = {street} tavern = Location('Таверна', player, boozy_hacksmith, where_to_go = {street}, is_inn = 1) forge = Location('Кузница', player, where_to_go = {street}) street.where_to_go.add(tavern) street.where_to_go.add(forge) location = street # Инициация предметов small_helmet = Armor('Маленький шлем', 1, 500, 'head', 0.5) mail_shirt = Armor('Кольчуга', 7, 2000, 'body', 2) armor_merchant.goods = {small_helmet, mail_shirt} ## armor_merchant.goods.add(small_helmet) ## armor_merchant.goods.add(mail_shirt) jacket = Armor('Куртка', 1, 100, 'body', 0.3) pants = Armor('Штаны', 0.5, 50, 'legs', 0) old_medallion = Item('Старый медальон', 0.1, 300) ## player.add_item(small_helmet) player.add_item(old_medallion) player.slots['body'] = jacket player.slots['legs'] = pants # Инициализация квестов quest_list = [] quest1 = Quest('Найти Таверну', 'Должна же здесь где-то быть таверна', 0, 'go_to_tavern') quest_list.append(quest1)